<?php
    @require_once("config.php");
	
	$con = $_GET["con"];
	$orderType = $_GET["orderType"];
	$type = $_GET["type"];
	$pageIndex = $_GET["pageIndex"]; // 1
	$showNum = $_GET["showNum"]; // 5
	
	$skipNum = $pageIndex*$showNum;
	
    $sql = "select * from goodslist where goods_title like '%$con%' order by $orderType $type limit $skipNum,$showNum ";
	// echo $sql;

    $result = mysql_query($sql);
	// $item = mysql_fetch_array($result);
	
	
    $all = array();
    while($item = mysql_fetch_assoc($result)){
        $arr = array();
        $arr["goods_id"] = $item["goods_id"];
        $arr["goods_title"] = $item["goods_title"];
        $arr["goods_price"] = $item["goods_current_price"];
        $arr["goods_trade_num"] = $item["goods_trade_num"];
        $arr["goods_pic"] = $item["goods_pic"];
        $arr["goods_sub_pic"] = explode(",", $item["goods_sub_pic"]);
        $arr["type"] =  $item["type"];

        $all[] = $arr;
    }

    echo json_encode($all);


?>